<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>动态绑定外部样式——错误写法</title>
    <style>
        .bg {
            background-color: silver;
        }
    </style>
</head>
<body>
<div id="app">
    <!-- 绑定样式 -->
    <!--  Property "bg" was accessed during render but is not defined on instance.   -->
    <!--  属性 bg 在渲染的过程中没有在 Vue 实例中进行定义  -->
    <h1 v-bind:class="bg">Hello, Vue</h1>

    <!--  在 Vue 实例中定义了样式，但是没有效果！  -->
    <h1 v-bind:class="background">Hello, Vue</h1>
</div>

<script type="module">
    import {createApp} from "../../../js/vue.esm-browser.js";

    let app = createApp(
        {
            setup() {
                let background = "background-color: silver;"
                return {
                    background,
                }

            }
        }
    );

    app.mount("#app")
</script>
</body>
</html>